fix(api-v2): correct endpoints and request bodies to match REST API v2#1
Merged
Conversation
…2 spec
Verified against the official RevenueCat OpenAPI v2 spec and fixed
discrepancies that caused requests to fail (404/405/400):
- apps api-keys: path was /apps/{id}/api_keys -> /apps/{id}/public_api_keys
(matches GET /projects/{project_id}/apps/{app_id}/public_api_keys)
- entitlements update: used HTTP PATCH -> POST
(spec defines POST /projects/{project_id}/entitlements/{entitlement_id})
- customers create: request body field app_user_id -> id
(spec requires the `id` field; app_user_id was rejected as missing-required)
- customers grant-entitlement: added required `expires_at` field and a new
--expires-at flag (ms since epoch); the API requires both entitlement_id
and expires_at, so grants previously failed validation
Verified correct and left unchanged: customer action slugs
(grant_entitlement / revoke_granted_entitlement / assign_offering),
flat package attach/detach paths, package attach product association shape
(product_id + eligibility_criteria=all), pagination (limit/starting_after/
next_page), Bearer auth, and base URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Compared the CLI against the official RevenueCat REST API v2 OpenAPI spec and fixed discrepancies that would cause live requests to fail.
Fixes (endpoint-by-endpoint)
apps api-keysGET /apps/{id}/api_keysGET /apps/{id}/public_api_keysentitlements updatePATCH /entitlements/{id}POST /entitlements/{id}customers create{"app_user_id": ...}{"id": ...}id)customers grant-entitlement{entitlement_id}only{entitlement_id, expires_at}+ new--expires-atflagexpires_at)Verified correct (left unchanged)
grant_entitlement,revoke_granted_entitlement,assign_offering/packages/{id}/actions/{attach,detach}_productsproduct_id+eligibility_criteria=alllimit/starting_after/next_page), Bearer auth, base URLhttps://api.revenuecat.com/v2,Content-Type: application/jsonTesting
go build ./...,go vet ./..., andgo test ./...all pass.